#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// 100.00 %
class Solution
{
  public:
	vector<int> plusOne(vector<int> &digits)
	{
		reverse(digits.begin(), digits.end());
		digits[0]++;
		for (int i = 0; i < digits.size() - 1; i++)
		{
			if (digits[i] > 9)
			{
				digits[i] %= 10;
				digits[i + 1]++;
			}
			else
			{
				break;
			}
		}
		if (digits[digits.size() - 1] > 9)
		{
			digits[digits.size() - 1] %= 10;
			digits.push_back(1);
		}
		reverse(digits.begin(), digits.end());
		return digits;
	}
};

int main()
{
	int arr[] = {0};
	int n = sizeof(arr) / sizeof(arr[0]);
	vector<int> myVector(arr, arr + n);
	myVector = Solution().plusOne(myVector);
	for (int i = 0; i < myVector.size() - 1; i++)
	{
		cout << myVector[i] << " ";
	}
	cout << myVector[myVector.size() - 1] << endl;
	return 0;
}
